package com.cqut.service.impl;

import com.cqut.entity.CourseMaterial;
import com.cqut.mapper.CourseMaterialMapper;
import com.cqut.service.CourseMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 冯永龙
 * @since 2021-06-15
 */
@Service
public class CourseMaterialServiceImpl implements CourseMaterialService {
    @Autowired
    private CourseMaterialMapper courseMaterialMapper;

    @Override
    public boolean addCourseMaterial(CourseMaterial courseMaterial) {
        return courseMaterialMapper.addMaterial(courseMaterial) == 1;
    }

    @Override
    public boolean deleteCourseMaterial(Integer materialId) {
        return courseMaterialMapper.deleteMaterial(materialId) == 1;
    }

    @Override
    public List<CourseMaterial> getCourseMaterials(Integer courseId) {
        return courseMaterialMapper.getMaterialsByCourseId(courseId);
    }
}
